package 比赛.赛氪.test;

import java.util.Scanner;
import java.util.Arrays;

public class test1 {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);

        int t = in.nextInt();
        for (int ti = 0; ti<t; ti++) {
            int n = in.nextInt();
            int k = in.nextInt();
            int a[] = new int[n+1];

            for (int i = 1; i <= n; i++) {
                a[i] = in.nextInt();
            }

            Arrays.sort(a);

            System.out.println(a[k]);
        }
    }
}
